package com.sbl.bajw.pc.action;

import java.util.HashMap;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sbl.bajw.common.web.RequestUnit;
import com.sbl.bajw.pc.service.DictModelService;
import com.sbl.bajw.util.JsonUtil;

@Controller
@RequestMapping("/DictModel")
public class DictModelAction {

	@Resource
	private DictModelService service;
	
	@RequestMapping(value = "/getInfoType")
	public @ResponseBody String getInfoType(HttpServletRequest request, HttpServletResponse response){
		List<HashMap<String, Object>> list = service.getInfoType();
		String json = JsonUtil.ConvertArrayToJson(list);
		return json;
	}
	
	@RequestMapping(value = "/getBuildintTypeType")
	public @ResponseBody String getBuildintTypeType(HttpServletRequest request, HttpServletResponse response){
		List<HashMap<String, Object>> list = service.getBuildintTypeType();
		String json = JsonUtil.ConvertArrayToJson(list);
		return json;
	}
	
	@RequestMapping(value = "/getPosition")
	public @ResponseBody String getPosition(HttpServletRequest request, HttpServletResponse response){
		List<HashMap<String, Object>> list = service.getPosition();
		String json = JsonUtil.ConvertArrayToJson(list);
		return json;
	}
	
	@RequestMapping(value = "/getUserType")
	public @ResponseBody String getUserType(HttpServletRequest request, HttpServletResponse response){
		List<HashMap<String, Object>> list = service.getUserType();
		String json = JsonUtil.ConvertArrayToJson(list);
		return json;
	}
	
	@RequestMapping(value = "/getTodoType")
	public @ResponseBody String getTodoType(HttpServletRequest request, HttpServletResponse response){
		List<HashMap<String, Object>> list = service.getTodoType();
		String json = JsonUtil.ConvertArrayToJson(list);
		return json;
	}
	
	@RequestMapping(value = "/getLogType")
	public @ResponseBody String getLogType(HttpServletRequest request, HttpServletResponse response){
		List<HashMap<String, Object>> list = service.getLogType();
		String json = JsonUtil.ConvertArrayToJson(list);
		return json;
	}
	
	@RequestMapping(value = "/getUserDict")
	public @ResponseBody String getUserDict(HttpServletRequest request, HttpServletResponse response){
		List<HashMap<String, Object>> list = service.getUserDict();
		String json = JsonUtil.ConvertArrayToJson(list);
		return json;
	}
	
	@RequestMapping(value = "/getSspoiDict")
	public @ResponseBody String getSspoiDict(HttpServletRequest request, HttpServletResponse response){
		List<HashMap<String, Object>> list = service.getSspoiDict();
		String json = JsonUtil.ConvertArrayToJson(list);
		return json;
	}

	@RequestMapping(value = "/getDeptDict")
	public @ResponseBody String getDeptDict(HttpServletRequest request, HttpServletResponse response){
		String id = RequestUnit.getString("id");
		List<HashMap<String, Object>> list = service.getDept(id);
		String json = JsonUtil.ConvertArrayToJson(list);
		return json;
	}
	
	@RequestMapping(value = "/getAlarmDict")
	public @ResponseBody String getAlarmDict(HttpServletRequest request, HttpServletResponse response){
		List<HashMap<String, Object>> list = service.getAlarmDict();
		String json = JsonUtil.ConvertArrayToJson(list);
		return json;
	}
}
